package com.hz.user.interfaces.impl;

import java.util.List;

import com.hz.beans.user.entity.TCounselling;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.code.HzOperateCode;
import com.hz.beans.user.entity.TReply;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.ITReplyInterface;
import com.hz.user.service.inf.ITReplyService;

/**
 * ITReplyService
 * @author mcz
 * @since [0.0.1]
 * @version [0.0.1,2018年10月19日]
 */
@Service("tReplyInterface")
public class TReplyInterface implements ITReplyInterface{
	
	@Autowired
	private ITReplyService tReplyService;
	

	@Override
	public CommonResult<TReply> queryTReply(Long id) {
		CommonResult<TReply> cr = new DemoResult<>();
		cr = tReplyService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_TREPLY);
		return cr;
	}

	@Override
	public String addTReplyConsu(TReply tReply, Long consuId) {
		return tReplyService.addTReplyConsu(tReply,consuId);
	}


	@Override
	public String addTReply2Reply(JSONObject object) {
		return tReplyService.addTReplyToReply(object);
	}

	@Override
	public List<TReply> queryTReplyAndQuesList(TCounselling tCounselling) {
		return tReplyService.queryTReplyAndQuesList(tCounselling);
	}

	@Override
	public CommonResult<TReply> addTReply(TReply tReply) {
		CommonResult<TReply> cr = new DemoResult<>();
		cr = tReplyService.insert(cr, tReply);
		cr.setOperate(HzOperateCode.ADD_TREPLY);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<TReply> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = tReplyService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TREPLY_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<TReply>> queryTReplyList(QueryParams<TReply> queryParams) {
		CommonResult<List<TReply>> cr = new DemoResult<>();
		cr = tReplyService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TREPLY_LIST);
		return cr;
	}

	@Override
	public CommonResult<TReply> updateTReply(TReply tReply) {
		CommonResult<TReply> cr = new DemoResult<>();
		cr = tReplyService.updateByPrimaryKey(cr, tReply);
		cr.setOperate(HzOperateCode.UPDATE_TREPLY);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteTReplyArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tReplyService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_TREPLY);
		return cr;
	}

	@Override
	public CommonResult<TReply> insertSelective(TReply tReply) {
		CommonResult<TReply> cr = new DemoResult<>();
		cr = tReplyService.insertSelective(cr, tReply);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_TREPLY);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<TReply> tReplyList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tReplyService.deleteByList(cr, tReplyList);
		cr.setOperate(HzOperateCode.DELETELIST_TREPLY);
		return cr;
	}

	@Override
	public CommonResult<List<TReply>> batchUpdate(List<TReply> tReplyList) {
		CommonResult<List<TReply>> cr = new DemoResult<>();
		cr = tReplyService.batchUpdate(cr, tReplyList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_TREPLY);
		return cr;
	}

	@Override
	public CommonResult<List<TReply>> batchSave(List<TReply> tReplyList) {
		CommonResult<List<TReply>> cr = new DemoResult<>();
		cr = tReplyService.batchSave(cr, tReplyList);
		cr.setOperate(HzOperateCode.BATCHSAVE_TREPLY);
		return cr;
	}

}
